import { reCategoryList,reBannerList,reqFloorList} from "@/api"
import { get } from "lodash"

//模块小仓库
const state = {
    //三级菜单数据
    categoryList: [],
    //轮播图数据
    bannerList:[],
    //楼层数据
    floorList:[]
}
//唯一修改state的地方
const mutations = {

    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    },
    GETBANNERLIST(state, bannerList) {        
        state.bannerList = bannerList
    }, 
    GETFLOORLIST(state, floorList) {        
        state.floorList = floorList
    }
}
const actions = {
    //通过api里面接口函数调用，获取数据
    
    async categoryList({ commit }) {
        let result = await reCategoryList();     
        if (result.code == 200) { 
            commit('CATEGORYLIST', result.data)
        }
    },
    async getBannerList({commit}) {
        
        let result = await reBannerList();
      if (result.code == 20) {
        commit('GETBANNERLIST', result.data)
      }
    },
async getFloorList({commit}) {
        let result = await reqFloorList();
        if (result.code == 20) {
            commit('GETFLOORLIST', result.data)
        }
}
}
const getters = {

}
export default {
    state,
    mutations,
    actions,
    getters
}